﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Inspector.Modules
{
    public partial class Developer : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void dropSelector_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var list = new List<string>();
                list.AddRange(new string[]{
            "Win32_COMApplication",
            "Win32_COMApplicationClasses",
            "Win32_COMApplicationSettings",
            "Win32_COMClass",
            "Win32_ComClassAutoEmulator",
            "Win32_ComClassEmulator",
            "Win32_COMSetting",
            "Win32_ODBCAttribute",
            "Win32_ODBCDataSourceAttribute",
            "Win32_ODBCDataSourceSpecification",
            "Win32_ODBCDriverAttribute",
            "Win32_ODBCDriverSoftwareElement",
            "Win32_ODBCDriverSpecification",
            "Win32_ODBCSourceAttribute",
            "Win32_ODBCTranslatorSpecification",
            "Win32_Perf",
            "Win32_PerfRawData",
            "Win32_PerfRawData_ASP_ActiveServerPages",
            "Win32_PerfRawData_ASPNET_114322_ASPNETAppsv114322",
            "Win32_PerfRawData_ASPNET_114322_ASPNETv114322",
            "Win32_PerfRawData_ASPNET_ASPNET",
            "Win32_PerfRawData_ASPNET_ASPNETApplications",
            "Win32_PerfRawData_IAS_IASAccountingClients",
            "Win32_PerfRawData_IAS_IASAccountingServer",
            "Win32_PerfRawData_IAS_IASAuthenticationClients",
            "Win32_PerfRawData_IAS_IASAuthenticationServer",
            "Win32_PerfRawData_InetInfo_InternetInformationServicesGlobal",
            "Win32_PerfRawData_MSDTC_DistributedTransactionCoordinator",
            "Win32_PerfRawData_MSFTPSVC_FTPService",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerAccessMethods",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerBackupDevice",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerBufferPartition",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerCacheManager",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerDatabases",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerGeneralStatistics",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerLatches",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerLocks",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerMemoryManager",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerReplicationAgents",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerReplicationDist",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerReplicationLogreader",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerReplicationMerge",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerReplicationSnapshot",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerSQLStatistics",
            "Win32_PerfRawData_MSSQLSERVER_SQLServerUserSettable",
            "Win32_PerfRawData_NETFramework_NETCLRExceptions",
            "Win32_PerfRawData_NETFramework_NETCLRInterop",
            "Win32_PerfRawData_NETFramework_NETCLRJit",
            "Win32_PerfRawData_NETFramework_NETCLRLoading",
            "Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads",
            "Win32_PerfRawData_NETFramework_NETCLRMemory",
            "Win32_PerfRawData_NETFramework_NETCLRRemoting",
            "Win32_PerfRawData_NETFramework_NETCLRSecurity",
            "Win32_PerfRawData_Outlook_Outlook",
            "Win32_PerfRawData_PerfDisk_PhysicalDisk",
            "Win32_PerfRawData_PerfNet_Browser",
            "Win32_PerfRawData_PerfNet_Redirector",
            "Win32_PerfRawData_PerfNet_Server",
            "Win32_PerfRawData_PerfNet_ServerWorkQueues",
            "Win32_PerfRawData_PerfOS_Cache",
            "Win32_PerfRawData_PerfOS_Memory",
            "Win32_PerfRawData_PerfOS_Objects",
            "Win32_PerfRawData_PerfOS_PagingFile",
            "Win32_PerfRawData_PerfOS_Processor",
            "Win32_PerfRawData_PerfOS_System",
            "Win32_PerfRawData_PerfProc_FullImage_Costly",
            "Win32_PerfRawData_PerfProc_Image_Costly",
            "Win32_PerfRawData_PerfProc_JobObject",
            "Win32_PerfRawData_PerfProc_JobObjectDetails",
            "Win32_PerfRawData_PerfProc_Process",
            "Win32_PerfRawData_PerfProc_ProcessAddressSpace_Costly",
            "Win32_PerfRawData_PerfProc_Thread",
            "Win32_PerfRawData_PerfProc_ThreadDetails_Costly",
            "Win32_PerfRawData_RemoteAccess_RASPort",
            "Win32_PerfRawData_RemoteAccess_RASTotal",
            "Win32_PerfRawData_RSVP_ACSPerRSVPService",
            "Win32_PerfRawData_Spooler_PrintQueue",
            "Win32_PerfRawData_TapiSrv_Telephony",
            "Win32_SoftwareElement",
            "Win32_SoftwareElementAction",
            "Win32_SoftwareElementCheck",
            "Win32_SoftwareElementCondition",
            "Win32_SoftwareElementResource",
            "Win32_SoftwareFeature",
            "Win32_SoftwareFeatureAction",
            "Win32_SoftwareFeatureCheck",
            "Win32_SoftwareFeatureParent",
            "Win32_SoftwareFeatureSoftwareElements",
            "Win32_ClassicCOMApplicationClasses",
            "Win32_ClassicCOMClass",
            "Win32_ClassicCOMClassSetting",
            "Win32_ClassicCOMClassSettings",
            "Win32_ClassInfoAction",
            "Win32_ClientApplicationSetting",
            "Win32_CodecFile",
            "Win32_DCOMApplication",
            "Win32_DCOMApplicationAccessAllowedSetting",
            "Win32_DCOMApplicationLaunchAllowedSetting",
            "Win32_DCOMApplicationSetting"});
                foreach (var item in list)
                {
                    dropSelector.Items.Add(new ListItem(item, item));
                }
            }
        }

        protected void dropSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            mainGrid.DataSource = InspectorUtils.GetMachineProperties(dropSelector.SelectedValue);
            mainGrid.DataBind();
        }
    }
}